package TestClasses;

import static org.junit.Assert.*;
import java.util.ArrayList;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ModelLayer.*;
import DBLayer.*;

public class DBProductTest {
	
	DBProduct dbp = new DBProduct();

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAllProducts() {
		ArrayList<Product> prod = dbp.getAllProducts(false);
	    System.out.println(prod.size());
	}

	@Test
	public void testFindProduct() {
		Product prod = dbp.findProduct(1, false);
		System.out.println(prod.getName());
	}

	@Test
	public void testSearchProductName() {
		Product prod = dbp.searchProductName("Bodyguard", true);
		System.out.println(prod.getName() + " " + prod.getSupplier().getName());
	}

	@Test
	public void testSearchProductDescription() {
		Product prod = dbp.searchProductDescription("Saddest", false);
		System.out.println(prod.getName() + " " + prod.getSupplier().getName());
	}

/*	@Test
	public void testInsertClothing() throws Exception {
		Clothing cloObj = new Clothing(1, "Levis 501", 200.00, 800.00, 100.00, "USA", 4, "Famous jeans from Levis", "36", "Blue", 2);
		dbp.insertClothing(cloObj);
	}*/

	@Test
	public void testUpdateClothing() throws Exception {
		Clothing cloObj = new Clothing(5, "Levis 501", 200.00, 800.00, 100.00, "USA", 4, "Jeans from Levis", "36", "Blue", 2);
		dbp.updateClothing(cloObj);
	}

/*	@Test
	public void testInsertEquipment() throws Exception {
		Equipment equObj = new Equipment(1, "Pistolbelt 1000", 400.50, 1200.00, 0.00, "Denmark", 19, "Belt with bullets", "Pistolbelts", 2);
		dbp.insertEquipment(equObj);
	}*/

	@Test
	public void testUpdateEquipment() throws Exception {
		Equipment equObj = new Equipment(6, "Pistolbelt 1000", 400.50, 1200.00, 0.00, "Denmark", 19, "Belt with bullets update", "Pistolbelts", 2);
		dbp.updateEquipment(equObj);
	}

/*	@Test
	public void testInsertGun() throws Exception{
		Gun gunObj = new Gun(1, "Sigsauer", 350.00, 900.00, 0.00, "Germany", 20, "Replica og Sigsauer", "Hansemann", "45", 2);
		dbp.insertGun(gunObj);
	}*/

	@Test
	public void testUpdateGun() throws Exception  {
		Gun gunObj = new Gun(7, "Sigsauer", 350.00, 900.00, 0.00, "Germany", 20, "Replica of Sigsauer update", "Hansemann", "45", 2);
		dbp.updateGun(gunObj);
	}

	@Test
	public void testDeleteProduct() {
		fail("Not yet implemented");
	}

}
